package krt.wid.gslzs.util;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.KeyboardShortcutGroup;
import android.view.Menu;
import android.view.View;
import android.widget.TextView;
import java.util.List;
import krt.wid.gslzs.R;

/**
 * Created by admin on 2018/5/10.
 */

public class SureDiagle extends Dialog implements View.OnClickListener {
    private Context mContext;
    private String content;
    private OnCloseListener listener;

     TextView diss;


    public SureDiagle(@NonNull Context context) {
        super(context);
    }

    public SureDiagle(@NonNull Context context, int themeResId) {
        super(context, themeResId);
    }

    protected SureDiagle(@NonNull Context context, boolean cancelable, @Nullable OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
    }
    public SureDiagle(Context context, int themeResId, String content, OnCloseListener listener) {
        super(context, themeResId);
        this.mContext = context;
        this.content = content;
        this.listener = listener;

    }

    @Override
    public void onProvideKeyboardShortcuts(List<KeyboardShortcutGroup> data, @Nullable Menu menu, int deviceId) {

    }

    @Override
    public void onPointerCaptureChanged(boolean hasCapture) {

    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.diss:
                if (listener !=null){
                    listener.onClick(this,true);
                }
                break;


        }
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.sure_dialog);
        setCanceledOnTouchOutside(false);
        setCancelable(false);
        diss=findViewById(R.id.diss);
        diss.setOnClickListener(this);

    }
    public interface OnCloseListener {
        void  onClick(Dialog dialog, boolean confirm);
    }

}
